	function $(id) {
		return document.getElementById(id);
	}
	
	function checkEmail(str) {
		var index = str.indexOf('@');
		if (index == -1){
			return false;
		} else {
			return true;
		}
	}
	
	function checkBeforePost() {

		if ( $('loginname').value.length == 0 ) {
			alert("Email Cannot Be Null!");
			return false;
		} 
		if ( $('loginpass').value.length == 0 ) {
			alert("Password Cannot Be Null");
			return false;
		}
		if ( !checkEmail($('loginname').value) ) {
			alert("Please fill in your Email address");
			return false;
		}
		
		return true;
	}
	function checkInput(){
		loginpass = $('loginpass')
		verifypass = $('verifypass')
		
		if ( $('email').value.length == 0) {
			alert('Email Cannot Be Null!');
			return false;
		}
		
		if ( $('realname').value.length == 0) {
			alert('Nickname Cannot Be Null!');
			return false;
		}
		
		if ( !checkEmail($('loginname').value) ) {
			alert("Please fill in your Email address");
			return false;
		}
		
		if ( loginpass.value.length == 0) {
			alert('Password Cannot Be Null!');
			return false;
		}
		
		if ( verifypass.value.length == 0) {
			alert('Confirm your password!');
			return false;
		}
		
		if ( loginpass.value.indexOf(verifypass.value) ||  verifypass.value.indexOf(verifypass.value)){
			alert('Passwords do not match!');
			return false;
		}
		
		return true;

	}